package com.ost.kautilya.utils.metrics;

import com.ost.kautilya.utils.Metric.DataType;

public class Minimum extends AbstractMetric {

	private static final long serialVersionUID = 1L;
	private double min;

	public Minimum(DataType dt) {
		super(dt);
		min = Double.POSITIVE_INFINITY;
	}

	@Override
	public void push(long index, Number number) {
		min = min > number.doubleValue() ? number.doubleValue() : min;
	}

	@Override
	protected double asDouble() {
		return min;
	}

	@Override
	public void reset() {
		min = Double.POSITIVE_INFINITY;
	}

}
